import java.util.*;

public class test19 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();// 数据个数
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = in.nextInt();
        }
        System.out.println(MLS(arr));
    }
    public static int MLS (int[] arr) {
        // 先转换为链表然后直接排序
        ArrayList<Integer> arrayList = new ArrayList<>();
        for (int i = 0; i < arr.length; i++) {
            arrayList.add(arr[i]);
        }
        Collections.sort(arrayList);
        int max = 1; //记录最多的 但是最小也是1
        int flag = 1;
        for (int i = 1; i < arrayList.size(); i++) {
            if (arrayList.get(i) - arrayList.get(i-1)==1){
                flag++;
                max = Math.max(max,flag);
            }else if(arrayList.get(i) - arrayList.get(i-1)!=0){
                flag = 1;
            }
        }
        return max;
    }
}
